<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../layui/css/layui.css">

</head>
<body>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="userTel" required  lay-verify="required" placeholder="请输入登录名或手机号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>

    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
<script src="../layui/layui.js"></script>
<script>
//Demo
layui.use(['jquery','form'], function(){
    var $ = layui.$;
    var form = layui.form;

    //监听提交
    form.on('submit(formDemo)', function(data){
        $.ajax({
            type:"post",
            url:"/mmybatis/user.do?method=login",
            data:data.field,
            success:function(resp){
                console.log(resp);
            }
        })
        return false;
    });
});
</script>
</html>